<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<link rel="stylesheet" type="text/css" href="../../../Themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../../../Themes/icon.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/demo.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/common.css">
		<script type="text/javascript" src="../../../JS/jquery.min.js"></script>
		<script type="text/javascript" src="../../../JS/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="../../../JS/common.js"></script>
		<script type="text/javascript" src='../../../JS/SHA-1.js'></script>
	</head>

	<body style="padding: 0px;">
		<div class="easyui-layout" style="width:100%;height:600px;">

			<div data-options="region:'center'">
				<div>
					<table id="dg" style="width: 100%;height: 350px;">
					</table>
				</div>
			</div>
		</div>
		<div id="toolbar"></div>
		<div id="dlg" class="hiddenDialog">
			<iframe id="ifrmEdit" style="width: 100%;height: 100%;" frameborder="0" scrolling="no"></iframe>
		</div>
	</body>
	<script>
		var currid = getMultiID();
		var listUrl = "";
		if(currid != undefined) {
			listUrl = RemoteLinkAddress + "/market/maintain/listbydevice.do?" + constructSpecialCondition(currid);
		} else {
			listUrl = RemoteLinkAddress + '/market/maintain/list.do';
		}
		var content = ""; /*定义一个空的content*/
		var AddDialog;
		content = AddToolBar(35); /**根据用户的权限，来决定生成ToolBar的哪些功能**/
		$("#toolbar").append(content); /*在ID=toolbar的标记后面添加content中的内容*/

		function newdata() {
			var pLocation = "UI/Market/EquipmentRepairManagement/EquipmentRepairManagementAdd.html?id=-1";
			AddTabIn("设备维护信息新增", parent.parent.$('#tabs'), pLocation);
		}

		function editdata() {
			var pLocation = "";
			var row = $('#dg').datagrid('getSelected');
			if(!row) {
				$.messager.alert('Info', "请选择你需要修改数据"); /*判断是否有表格被选中，如果没有，则弹出警告框，提示用户修改数据*/
				return;
			}
			pLocation = "UI/Market/EquipmentRepairManagement/EquipmentRepairManagementAdd.html?id=" + row.ID; /*将BoothManagementAdd.html的相对路径与被选中行的ID赋值给pLocation*/
			AddTabIn("设备维护信息修改", parent.parent.$('#tabs'), pLocation);
		}

		function redodata() {
			var _url = listUrl;
			$.ajax({
				dataType: "json",
				type: "get",
				url: _url,
				success: function(result) {
					if(result != null) {
						var _data = result;
						$('#dg').datagrid('loadData', _data);
					}
				},
				error: function(xhr, status, error) {
					$.messager.alert("错误", "请求失败!");
				}
			});
		}

		$('#dg').datagrid({
			url: listUrl,
			toolbar: '#toolbar',
			method: 'get',
			pagination: 'true',
			rownumbers: 'true',
			fitColumns: 'false',
			singleSelect: 'true',
			height: 350,
			columns: [
				[{
					field: 'ID',
					title: 'ID',
					width: '0%',
					align: 'center'
				}, {
					field: 'REGION_TYPE',
					title: '区域类型',
					width: '24%',
					align: 'center'
				}, {
					field: 'REGION',
					title: '区域名称',
					width: '24%',
					align: 'center'
				}, {
					field: 'WORKER',
					title: '维修人',
					width: '12%',
					align: 'center'
				}, {
					field: 'FEES_SUM',
					title: '维修金额',
					width: '24%',
					align: 'center',
					formatter: function(value, row, index) {
						if(value) {
							return '￥' + value + '元';
						}
					}
				}, {
					field: 'ISVERIFY',
					title: '审核状态',
					width: '12%',
					align: 'center',
					formatter: function(value, row, index) {
						return verifyStatus(value, false);
					}
				}]
			],
			onDblClickRow: function(index, row) {
				pLocation = "UI/Market/EquipmentRepairManagement/EquipmentRepairManagementAdd.html?id=" + row.ID; /*将BoothManagementAdd.html的相对路径与被选中行的ID赋值给pLocation*/
				AddTabIn("设备维护信息修改", parent.parent.$('#tabs'), pLocation);
			}
		});
		$('#dg').datagrid('hideColumn', 'ID');
	</script>

</html>